package com.java.array;

import java.util.Scanner;

public class ArrayDemo4 {

    public static void main(String[] args) {
        //定义3行5列的字符串数组
        String[][] names = new String[3][5];
        Scanner scanner = new Scanner(System.in);
        //循环输入姓名
        for(int i = 0;i < names.length;i++){
            System.out.println("输入第" + (i + 1) +"班学生：");
            for (int j = 0;j < names[i].length;j++){
                System.out.println("输入第" + (j + 1) +"个学生姓名");
                names[i][j] = scanner.nextLine();
            }
        }
        //格式化输出姓名
        for (int i = 0; i < names.length; i++) {
            System.out.println("第" + (i + 1) +"个班：");
            for(int j = 0;j < names[i].length;j++){
                System.out.print("\t" + names[i][j]);
            }
            System.out.println();
        }
    }
}
